package com.qf.exception;

import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;

@Controller
public class MySystemHandler implements ErrorController {

    @RequestMapping("/error")
    public String errorHandler(HttpServletResponse response){

        //获得响应的状态码
        int status = response.getStatus();
        switch (status){
            case 404:
                return "404";
        }

        return "myerror";
    }

    @Override
    public String getErrorPath() {
        return "/error";
    }
}
